import numpy as np
#有网站分析的NumPy数据如下：
## Website analytics data:
## (row = day), (col = users, bounce, duration)
a = np.array([[815, 70, 115],
              [767, 80, 50],
              [912, 74, 77],
              [554, 88, 70],
              [1008, 65, 128]])
mean, stdev = np.mean(a, axis=0), np.std(a, axis=0)
# [811.2  76.4  88. ], [152.97764543   6.85857128  29.04479299]
#超出平均值一个标准差的值称为outlier，现在要找出users, bounce, duration三个值都为outlier的行，应如何操作？
def calc():
    outliers = ((np.abs(a[:, 0]) - mean[0]) > stdev[0]) * ((np.abs(a[:, 1]) - mean[1]) > stdev[1]) * ((np.abs(a[:, 2]) - mean[2]) > stdev[2])
    return a[outliers]

print(calc())
